# 作者：一只牛吗
# 2025 年02月 03日 03时 19分 40秒
# 1278599690@qq.com

# 同一条指令，不同的对象，产生的行为是不一样的
class Animal:
    def __init__(self, name):
        self.name = name


class Cat(Animal):
    # def __init__(self, name):
    #     super().__init__(name)

    def game(self):
        print(f"{self.name} is playing with clew.")


class Dog(Animal):
    # def __init__(self, name):
    #     super().__init__(name)

    def game(self):
        print(f"{self.name} is playing with ball.")


class XiaoTianDog(Dog):
    def game(self):
        print(f"{self.name} is playing with ball and running.")


class TomCat(Cat):
    def game(self):
        print(f"{self.name} is playing with clew and running.")


class Human:
    def __init__(self, name):
        self.name = name

    def game_with_animal(self, animal):
        print(f"{self.name} is playing with {animal.name}.")
        animal.game()


if __name__ == '__main__':
    zhangsan = Human("ZhangSan")
    xiaotian = XiaoTianDog("XiaoTian")
    tom = TomCat("Tom")
    mewo = Cat("MeWo")
    zhangsan.game_with_animal(mewo)
    zhangsan.game_with_animal(tom)
    zhangsan.game_with_animal(xiaotian)